package Code.StaticDemo;

public class Student {
    private String name;
    private int age;
    private String gender;

    /*被static修饰的成员变量，叫做静态变量
        特点：被该类的所有对象共享
        静态变量不属于对象，属于类的
        随着类的加载而加载，优先于对象存在
     */
    public static String teacherName;

    public Student() {
    }

    public Student(String name, int age, String gender) {
        this.name = name;
        this.age = age;
        this.gender = gender;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public void study() {
        System.out.println("this："+this);
        System.out.println(name + "正在学习");
    }

    //this表示当前方法调用的地址值
    public void show(Student this) {

        System.out.println(name + "," + age + "," + gender + "," + teacherName);
    }

    public static void method(){
        //System.out.println(this.name);
        System.out.println("静态方法");
    }
}
